package com.aat.dxfy.clsloader;

import java.net.URL;
import java.net.URLClassLoader;

public class TestURLClassloader {
	public static void main(String args[]) {
		try {

			URL url = new URL("file:E:\\workspace\\application\\target\\test.jar");

			@SuppressWarnings("resource")
			URLClassLoader myClassLoader = new URLClassLoader(new URL[] { url },Thread.currentThread().getContextClassLoader());

			Class<?> myClass = myClassLoader.loadClass("org.aat.application.UserServiceImpl");

			UserService action = (UserService) myClass.newInstance();

			String str = action.say("hello");

			System.out.println(str);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}